﻿using System;
using System.Data.Linq.Mapping;

namespace EbbinghausWord.Entities
{
    /// <summary>
    /// 用户记忆单词表
    /// </summary>
    [Table]
    public class TableUserWordEntity : BaseTableEntity
    {
        public TableUserWordEntity()
        {
            //RememberStatus = RememberStatus.NotRemember;
            //IsInTheWordBook = false;
            //StartRemeberingDateTime = DateTime.Now;
            //LastRemeberingDateTime = DateTime.Now;
            //_orderRandom = Guid.NewGuid().ToString();
        }

        private string _english;

        /// <summary>
        /// 英语
        /// </summary>
        [Column(IsPrimaryKey = true, IsDbGenerated = false, DbType = "NVarChar(200) NOT NULL",
         CanBeNull = false, AutoSync = AutoSync.Never)]
        public string English
        {
            get { return _english; }
            set
            {
                if (_english == value) return;

                NotifyPropertyChanging("English");
                _english = value;
                NotifyPropertyChanged("English");
            }
        }

        private int _rememberLevel;
        /// <summary>
        /// 记忆级别
        /// </summary>
        [Column]
        public int RememberLevel
        {
            get { return _rememberLevel; }
            set
            {
                if (_rememberLevel == value) return;

                NotifyPropertyChanging("RememberLevel");
                _rememberLevel = value;
                NotifyPropertyChanged("RememberLevel");
            }
        }

        private DateTime? _startRemeberingDateTime;
        /// <summary>
        /// 开始记忆的时间
        /// </summary>
        [Column]
        public DateTime? StartRemeberingDateTime
        {
            get { return _startRemeberingDateTime; }
            set
            {
                if (_startRemeberingDateTime == value) return;

                NotifyPropertyChanging("StartRemeberingDateTime");
                _startRemeberingDateTime = value;
                NotifyPropertyChanged("StartRemeberingDateTime");
            }
        }


        private bool _isInTheWordBook;
        /// <summary>
        /// 是否在单词本中
        /// </summary>
        [Column]
        public bool IsInTheWordBook
        {
            get
            {
                return _isInTheWordBook;
            }
            set
            {
                if (_isInTheWordBook == value) return;

                NotifyPropertyChanging("IsInTheWordBook");
                _isInTheWordBook = value;
                NotifyPropertyChanged("IsInTheWordBook");
            }
        }


        private int _rememberCounter;
        /// <summary>
        /// 记忆计数器
        /// </summary>
        [Column]
        public int RememberCounter
        {
            get { return _rememberCounter; }
            set
            {
                if (_rememberCounter == value) return;

                NotifyPropertyChanging("RememberCounter");
                _rememberCounter = value;
                NotifyPropertyChanged("RememberCounter");
            }
        }


        private int _notRememberCounter;
        /// <summary>
        /// 未记住的计数器
        /// </summary>
        [Column]
        public int NotRememberCounter
        {
            get { return _notRememberCounter; }
            set
            {
                if (_notRememberCounter == value) return;

                NotifyPropertyChanging("NotRememberCounter");
                _notRememberCounter = value;
                NotifyPropertyChanged("NotRememberCounter");
            }
        }

        private int _rememberTimes;

        /// <summary>
        /// 记忆次数，记住3次则算做记住
        /// </summary>
        [Column]
        public int RememberTimes
        {
            get { return _rememberTimes; }
            set
            {
                if (_rememberTimes == value) return;

                NotifyPropertyChanging("RememberTimes");
                _rememberTimes = value;
                NotifyPropertyChanged("RememberTimes");
            }
        }

        private DateTime? _lastRemeberingDateTime;
        /// <summary>
        /// 最后记忆时间，用于熟词复习
        /// </summary>
        [Column]
        public DateTime? LastRemeberingDateTime
        {
            get { return _lastRemeberingDateTime; }
            set
            {
                if (_lastRemeberingDateTime == value) return;

                NotifyPropertyChanging("LastRemeberingDateTime");
                _lastRemeberingDateTime = value;
                NotifyPropertyChanged("LastRemeberingDateTime");
            }
        }


        private string _orderRandom;
        /// <summary>
        /// 随机排序的字段
        /// </summary>
        [Column]
        public string OrderRandom
        {
            get { return _orderRandom; }
            set
            {
                if (_orderRandom == value) return;

                NotifyPropertyChanging("OrderRandom");
                _orderRandom = value;
                NotifyPropertyChanged("OrderRandom");
            }
        }

    }
}
